package dq.thread;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.Scanner;

/**
 * @Author: Dang Qi
 * @Date: 2021/4/1  15:48
 * @Description:
 */

public class Client2 {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket();
        socket.connect(new InetSocketAddress("127.0.0.1", 9876));

        System.out.println("--请输入内容--");
        Scanner scanner = new Scanner(System.in);
        while (true) {
            String next = scanner.next();
            socket.getOutputStream().write(next.getBytes());
        }
    }

}
